package com.example.demospring;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;

public class SystemInfoUtils {

    public static String getSystemTime() {
        return new Date().toString();
    }

    public static String getSystemVersion() {
        return System.getProperty("java.version");
    }

    public static String getServerInfo() {
        try {
            InetAddress localHost = InetAddress.getLocalHost();
            return localHost.getHostName() + " (" + localHost.getHostAddress() + ")";
        } catch (UnknownHostException e) {
            return "无法获取服务器信息";
        }
    }
}